package com.wdc.Map;

import java.util.concurrent.*;

public class F {


    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(1);


        Callable<Integer> task = () -> {
            TimeUnit.SECONDS.sleep(4);
            return 1 + 1;
        };

        Future<Integer> future = executorService.submit(task);

        try {
            Integer res = future.get();
            System.out.println(res);
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            throw new RuntimeException(e);
        }finally {
            executorService.shutdown();

        }
    }
}
